/**
 * 学校表model
 * author:cjf
 * 现有字段:学校编号(school_id)描述(Integer、非空、唯一)、
 * 学校名称(school_name)描述(String(100)、非空、唯一)
 */
import { DbContext } from '@codefree/badger/service'
const db = DbContext.Sequelize;

export type SchoolEntity = {
    school_id:Number,
    school_name:String
}

const schoolEntity:SchoolEntity = {
    school_id:{
        type:db.INTEGER,
        allowNull:false,
        unique:true
    },
    school_name:{
        type:db.STRING(100),
        allowNull:false,
        unique:true
    }
}

export default (sequelize) => {
    return {
        name: 'School',
        define: sequelize.define("school", schoolEntity, DbContext.defaultOptions)
    }
}